package com.example.myproject.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class FileUploadConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 绝对路径写法，注意 file:/ 前面有斜杠
        registry.addResourceHandler("/uploads/**")
                .addResourceLocations("file:/C:/Users/wyt/Desktop/ratio-king13/uploads/");
    }
}